import { inject, injectable } from "inversify";
import { Uri, ConfigurationTarget } from "vscode";
import { IInterpreterAutoSelectionService } from "../../interpreter/autoSelection/types";
import { IServiceContainer } from "../../ioc/types";
import { IWorkspaceService } from "../application/types";
import { EQSettings } from "../configSettings";
import { IConfigurationService, IDefaultLanguageServer, IEQSettings, IInterpreterPathService } from "../types";

@injectable()
export class ConfigurationService implements IConfigurationService {
    private readonly workspaceService: IWorkspaceService;
    constructor(@inject(IServiceContainer) private readonly serviceContainer: IServiceContainer) {
        this.workspaceService = this.serviceContainer.get<IWorkspaceService>(IWorkspaceService);
    }
    public getSettings(resource?: Uri): IEQSettings {
        const InterpreterAutoSelectionService = this.serviceContainer.get<IInterpreterAutoSelectionService>(
            IInterpreterAutoSelectionService,
        );
        const interpreterPathService = this.serviceContainer.get<IInterpreterPathService>(IInterpreterPathService);
        const defaultLS = this.serviceContainer.tryGet<IDefaultLanguageServer>(IDefaultLanguageServer);
        return EQSettings.getInstance(
            resource,
            InterpreterAutoSelectionService,
            this.workspaceService,
            interpreterPathService,
            defaultLS,
        );
    }
    isTestExecution(): boolean {
        throw new Error("13Method not implemented.");
    }
    updateSetting(setting: string, value?: unknown, resource?: Uri, configTarget?: ConfigurationTarget): Promise<void> {
        throw new Error("14Method not implemented.");
    }
    updateSectionSetting(section: string, setting: string, value?: unknown, resource?: Uri, configTarget?: ConfigurationTarget): Promise<void> {
        throw new Error("15Method not implemented.");
    }
}